package com.fuershiye.woman.monitor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fuershiye.woman.monitor.beans.IdName;
import com.fuershiye.woman.monitor.dao.IndicatorTypeDao;
import com.fuershiye.woman.monitor.model.IndicatorType;
import com.fuershiye.woman.monitor.service.IndicatorTypeService;

@Service("indicatorTypeService")
public class IndicatorTypeServiceImpl implements IndicatorTypeService {

	@Autowired
	private IndicatorTypeDao itDao;

	@Override
	public void save(IndicatorType it) {
		itDao.save(it);
	}

	@Override
	public void delete(Long id) {
		itDao.delete(id);
	}

	@Override
	public IndicatorType get(Long id) {
		return itDao.get(id);
	}

	/**
	 * 取当前表中最大数据
	 * 
	 * @return
	 */
	public IndicatorType getTop() {
		return itDao.getTop();
	}

	/**
	 * @param sort
	 *            sort(当前位置)
	 * @param aim
	 *            方向 (1:比id大的; 2:比id小的)
	 * @param count
	 *            取几条数据
	 * @return
	 */
	@Override
	public IndicatorType findBySort(Long sort, Integer aim, Integer count) {
		return itDao.findBySort(sort,aim,count);
	}

	@Override
	public List<IndicatorType> listByCondition(Long formsid, String name, Integer status) {
		return itDao.list(null,"", formsid, name, status);
	}

	@Override
	public List<IndicatorType> listByCondition(List<Long> ids, Long formsid, String name, Integer status) {
		return itDao.list(ids,"", formsid, name, status);
	}

	@Override
	public List<IdName> getByCondition(Long formsid, String name, Integer status) {
		return itDao.get("", formsid, name, status);
	}

	@Override
	public List<IdName> getByCondition(Long formsid, List<Long> ids) {
		return itDao.listByCondition("", "", formsid, ids, null);
	}

}
